<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	<h:head>  
    </h:head> 
	
<h:body>
<ui:composition template="/WEB-INF/templates/templateMain.xhtml">
	<ui:define name="content">
	    <p:panel>
			<h:form>
			<h1> Nova solicitação </h1>
			<p:commandButton value="Adicionar Solicitação" action="#{solicitacaoBean.manutencaoDeSolicitacao}" ajax="false"/>
			<br></br>			
			<h1>Listagem de solicitações</h1>
			<p:dataTable border="1" value="#{solicitacaoBean.solicitacoes}" var="item">
			<p:column>
				<f:facet name="header">
					<h:outputText value="Paciente"></h:outputText>
				</f:facet>
					<h:outputText value="#{item.PACIENTE.PACIENTE_NOME}"></h:outputText>
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Status"></h:outputText>
				</f:facet>
					<h:outputText value="#{item.STATUS.STATUS_NOME}"></h:outputText>
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Ações"></h:outputText>
				</f:facet>
					<h:commandLink value="Editar" action="#{solicitacaoBean.manutencaoDeSolicitacao}" ajax="false">
						<f:setPropertyActionListener target="#{solicitacaoBean.solicitacaoSelecionada}" value="#{item}"></f:setPropertyActionListener>
					</h:commandLink>
			</p:column>
			</p:dataTable>
			</h:form>
		</p:panel>
	</ui:define>
</ui:composition>
</h:body>
</html>